/**
 * @brief 彩色灯
 */
#pragma once
#include "LightDimmer.h"

class LightColor final : public LightDimmer
{
public:
    static constexpr uint16_t kDeviceTypeColorLight = 0x010D;
    explicit LightColor(const BasicInformation* node);

    void UpdateColorMode(uint8_t mode);
    void UpdateColorTemperature(uint16_t value);
    void SetColorTemperature(uint16_t value);
    void SetHueAndSaturation(uint8_t hue, uint8_t saturation);
    void UpdateHueAndSaturation(uint8_t hue, uint8_t saturation);

    Protocols::InteractionModel::Status ReadAttribute(
        ClusterId clusterId,
        AttributeId attributeId,
        uint8_t* buffer,
        uint16_t maxReadLength) override;

    Protocols::InteractionModel::Status WriteAttribute(
        ClusterId clusterId,
        const EmberAfAttributeMetadata* attributeMetadata,
        uint8_t* buffer) override;

    ChipError OnReport(const DataBlock* block) override;

private:
    uint8_t mCurrentHue;
    uint8_t mCurrentSaturation;
    uint16_t mCurrentCT = 2700;
    uint16_t mRemainingTime = 0x0000;
    uint8_t mColorMode;
    uint16_t mColorCapabilities = 0x0000;
};
